home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / elk-2_0.lha / elk-2.0 / examples / xaw / clickcount < prev    next >
Encoding:
Text File  |  1991-09-27  |  752 b   |  28 lines

  1. ;;; -*-Scheme-*-
  2. ;;;
  3. ;;; Demonstrate usage of translations and actions.
  4. ;;;
  5. ;;; Based on an example program (xclickcount.c) from the O'Reilly
  6. ;;; collection of Xt example programs.
  7.  
  8. (require 'xwidgets)
  9. (load-widgets shell label)
  10.  
  11. (define top (application-initialize 'clickcount))
  12. (define con (widget-context top))
  13.  
  14. (define increment-count
  15.   (let ((count 0))
  16.     (lambda (w event . args)
  17.       (set! count (1+ count))
  18.       (set-values! w 'label (format #f "# of clicks: ~s" count)))))
  19.  
  20. (context-add-action con 'increment-count increment-count)
  21.  
  22. (define label (create-managed-widget (find-class 'label) top
  23.   'width 150 'label "Click here"))
  24. (set-values! label 'translations "<BtnDown>: increment-count()")
  25.  
  26. (realize-widget top)
  27. (context-main-loop con)
  28.